package designpattern.abstractfactory.factory;

import designpattern.abstractfactory.service.Color;
import designpattern.abstractfactory.service.Price;
import designpattern.abstractfactory.service.Shape;

public class ShapeFactory extends AbstractFactory {
    @Override
    public Color getColor(Class<? extends Color> clazz) {
        return null;
    }

    @Override
    public Shape getShape(Class<? extends Shape> clazz) {
        if (clazz == null){
           throw new RuntimeException("不能为空");
        }
        Shape shape = null;
        try {
            shape = (Shape) clazz.newInstance();
        }catch (Exception e){
            System.out.println("反射获取类信息发生异常 "+ e.getMessage());
            e.printStackTrace();
        }
        return shape;
    }

    @Override
    public Price getPrice(Class<? extends Price> clazz) {
        return null;
    }
}
